package com.btb.adapter.vo.response;

import java.util.Objects;
import java.util.Optional;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Builder
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Data
@ToString
public class CommonResponse<T> {

	private Integer code;
	private String message;
	private T t;
	private String version;

	public boolean isOk() {
		return Optional.ofNullable(code).filter(Objects::nonNull).map(x-> x.intValue() == 0).orElse(Boolean.FALSE);
	}
}
